#ifndef REMOTERESOURCE_H
#define REMOTERESOURCE_H

#include <Resource.h>

class RemoteResource : public Resource
{
public:
  RemoteResource(Callable *target, const char *name=NULL);
  ~RemoteResource();
  
  /**
    This pushes a new call to the target process' call queue.
  **/
  int callSys(u32int id, bool synchronous, int p1=0, int p2=0, int p3=0, int p4=0, int p5=0);
  
  void setOwner(u32int pid)
  {
    owner = pid;
  }
  u32int getOwner()
  {
    return owner;
  }
  
private:
  u32int owner;
  
};

/**
  Creates a new resource (RemoteResource).
**/
int createResource(const char *name, Callable *target);

/**
  Adds a new function to the given resource.
**/
int addFunction(int resource, Resource::Call0 pCall, int fId);
int addFunction(int resource, Resource::Call1 pCall, int fId);
int addFunction(int resource, Resource::Call2 pCall, int fId);
int addFunction(int resource, Resource::Call3 pCall, int fId);
int addFunction(int resource, Resource::Call4 pCall, int fId);
int addFunction(int resource, Resource::Call5 pCall, int fId);

/**
  Destroys the resource.
**/
int destroyResource(int resource);

#endif
